home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / lib / objcol2 / sample / test2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-12  |  1.3 KB  |  77 lines

  1. /* Sample of "filesel.o", linked with filesel.o vircon.o symbol.o sort.o
  2.                                                            By SAKU    */
  3. #include <stdio.h>
  4. #include <dir.h>
  5. #include <egb.h>
  6. #include "filesel.h"
  7. #include "vircon.h"
  8.  
  9. #define ERR        1
  10. #define NOERR    0
  11.  
  12. char    egbwork[1536];
  13. char    moswork[4096];
  14.  
  15. void    init()
  16. {
  17.     EGB_init( egbwork, 1536 );
  18.     EGB_resolution( egbwork, 1, 3 );
  19.     EGB_writePage( egbwork, 1 );
  20.     EGB_displayPage( egbwork, 0, 3 );
  21.  
  22.     MOS_start( moswork );
  23.     MOS_sysIcon( 81, 0, 0, 0 );
  24.     MOS_color( 0, 15 );
  25.     MOS_writePage( 1 );
  26.  
  27.     return;
  28. }
  29.  
  30. void    end()
  31. {
  32.     MOS_disp( 0 );
  33.     MOS_end();
  34.     screenterm( egbwork );
  35.     return;
  36. }
  37.  
  38. int        main( int argc, char *argv[] )
  39. {
  40.     char    path[256];
  41.     char    *allfile = "*.*";
  42.     char    *wild;
  43.     int        size;
  44.  
  45.     init();
  46.     VC_init( egbwork, 0, 240, 60, 8, 15, 1 );
  47.     MOS_disp( 1 );
  48.  
  49.     if( argc > 1 )
  50.         wild = argv[1];
  51.     else
  52.         wild = allfile;
  53.  
  54.  
  55.     FS_locate( 0, 0 );
  56.  
  57.     while(1)
  58.     {
  59.         if( FS_fileSelect( egbwork, wild, path ) )
  60.         {
  61.             end();
  62.             return NOERR;
  63.         }
  64.         else
  65.         {
  66.             if( ( size = _get_file_size( path ) ) < 0 )
  67.             {
  68.                 VC_printf( "\"%s\" cannot found.\n", POINTER, path );
  69.                 end();
  70.                 return ERR;
  71.             }
  72.             VC_printf( "select file = \"%s\"\n", POINTER, path );
  73.             VC_printf( "filesize    = %d (byte)\n", L_INT, size );
  74.         }
  75.     }
  76. }
  77.